﻿<go:ControlPageBase 
    xmlns:my="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    x:Class="SuperGo.Silverlight.ContinueExistingGame"
    xmlns="http://schemas.microsoft.com/client/2007" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:go="clr-namespace:SuperGo.Silverlight"
    >

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="350" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>

        <Grid Grid.RowSpan="3" Grid.ColumnSpan="3" Background="Gray" Opacity=".7" />

        <go:GoPanel x:Name="_continueAGamePanel" Title="Active Games and Requests" Grid.Row="1" Grid.Column="1" >
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition Height="22" />
                </Grid.RowDefinitions>

                <my:DataGrid x:Name="_gamesInProgess" HeadersVisibility="Column" IsReadOnly="True" AutoGenerateColumns="False" Margin="0,0,0,5" Grid.Row="0">
                    <my:DataGrid.Columns>
                        <my:DataGridTemplateColumn Width="30">
                            <my:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <Button Content="{Binding GameId}" Visibility="Collapsed" />
                                        <Button x:Name="_continueGame" Height="20" Width="20" Canvas.ZIndex="100" Tag="{Binding GameIdAsString}" Style="{StaticResource ContinueButton}" Click="ContinueExisting_Click" Visibility="{Binding InProgress}" />
                                        <Button x:Name="_viewGameRequest" FontSize="16" FontFamily="Arial Black" Height="20" Width="20" Tag="{Binding GameIdAsString}" Content="?" Canvas.ZIndex="100" Style="{StaticResource RoundButton}" Visibility="{Binding Requested}" Click="ViewGameRequest_Click" />
                                    </StackPanel>
                                </DataTemplate>
                            </my:DataGridTemplateColumn.CellTemplate>
                        </my:DataGridTemplateColumn>
                        <my:DataGridTextColumn Header="#" Width="30" DisplayMemberBinding="{Binding GameId}" />
                        <my:DataGridTextColumn Header="Opponent" DisplayMemberBinding="{Binding Opponent}" />
                        <my:DataGridTextColumn Header="Status" DisplayMemberBinding="{Binding Status}" />
                    </my:DataGrid.Columns>
                </my:DataGrid>

                <go:ButtonPanel x:Name="_buttonPanel" Grid.Row="1">
                    <Button x:Name="_startNewGame" VerticalAlignment="Bottom" Content="Start New" Height="22" Margin="0" />
                    <Button x:Name="_cancel" VerticalAlignment="Bottom" Content="Cancel" Height="22" Margin="0" />
                </go:ButtonPanel>
            </Grid>
        </go:GoPanel>

    </Grid>
</go:ControlPageBase>
